//
//  ImageDetailViewController.h
//  reacticons
//
//  Created by Nong Nghia on 6/22/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "FBConnect.h"
#import "Facebook.h"
#import <MessageUI/MFMailComposeViewController.h>
#import "PublicDelegate.h"
#import <AddressBookUI/AddressBookUI.h>

@class TwitterHelper;
@class ImageScrollView;
@class CropImageView;

@interface ImageDetailViewController : UIViewController<UIScrollViewDelegate, UIActionSheetDelegate,UIAlertViewDelegate,
FBRequestDelegate,
FBSessionDelegate,
FBDialogDelegate,
FBLoginDialogDelegate,
MFMailComposeViewControllerDelegate,
UINavigationControllerDelegate,
PublicDelegate,
UIWebViewDelegate,
ABPeoplePickerNavigationControllerDelegate,ABPersonViewControllerDelegate>
{
    TwitterHelper *twitter;
    
    UIScrollView *pagingScrollView;
    CropImageView * cropView;
    
    NSMutableSet *recycledPages;
    NSMutableSet *visiblePages;
    
    // these values are stored off before we start rotation so we adjust our content offset appropriately during rotation
    int           firstVisiblePageIndexBeforeRotation;
    CGFloat       percentScrolledIntoFirstVisiblePage;
    
    IBOutlet UIToolbar *favouriteToolbar;
    IBOutlet UIToolbar *utilitiesToolbar;
    IBOutlet UIToolbar *editingToolbar;
    IBOutlet UIBarButtonItem * addToFavoriteButton;
    IBOutlet UIBarButtonItem * saveBtn;
    
    UITextField *inputMeme;
    CGPoint lastLocation;
    
    BOOL isFullScreen;
    BOOL isEditing;
    BOOL isCropping;
    
    IBOutlet UIBarButtonItem *exportBtn;
    IBOutlet UIBarButtonItem *deleteBtn;
    
    UILabel *popupLabel;

}
@property (nonatomic,retain) Facebook *facebook;

@property (nonatomic,retain) NSMutableArray *itemList;
@property (nonatomic) int itemIndex;
@property (nonatomic,retain) NSString* itemType;

- (void)configurePage:(ImageScrollView *)page forIndex:(NSUInteger)index;
- (BOOL)isDisplayingPageForIndex:(NSUInteger)index;

- (CGRect)frameForPagingScrollView;
- (CGRect)frameForPageAtIndex:(NSUInteger)index;
- (CGSize)contentSizeForPagingScrollView;

- (void)tilePages;

- (ImageScrollView *)dequeueRecycledPage;

- (NSUInteger)imageCount;
- (NSString *)imageNameAtIndex:(NSUInteger)index;
- (CGSize)imageSizeAtIndex:(NSUInteger)index;
- (UIImage *)imageAtIndex:(NSUInteger)index;

@end
